Government in UK political and legal terminology ostensibly refers to the formation called the cabinet and the prime minister. If you do not win a general election you cannot form a government. Therefore you lose the GE you are not elected to government
> If you do not win a general election you cannot form a government.
On the contrary. All you need to form a government is some way to get a majority for Confidence, and all you'd need to make that a working government is Confidence and Supply. That's all Theresa May had, she did not win the election but she had DUP promises to vote for her on the question of confidence and where necessary for supply, and that was enough to limp on for quite some time.
Of the last 4 Prime Minsters (Johnson, May, Cameron, Brown) of the UK, none of them became prime minister by heading a party who won a majority of seats at an election -- the last person to do that was Tony Blair in 1997. Before then it was Margaret Thatcher in 1979. It's an exception, rather than the rule.
Cameron did win a plurarity of seats in 2010, but his 36% of the vote wasn't enough on it's own.
It's exceedingly likely the next Prime Minister will equally be appointed without a public vote.