If a non-customer walks into the bank and tries to cash a $180K cashier's check and asks for $5000 in cash and the remainder in a cashier's check, do I legally have to do this?
No, you do not. If the cashier's check was issued by your bank and you can properly identify the presenter as the payee, you can cash it or let them deposit it. There is no legal requirement to allow them to convert the cashier's cehck to another cashier's check of a lesser amount.
And if they don't want to open an account do I have to cash it for them?
Not unless it is your bank's cashier's check and the payee can be properly identified.
How do we know when a check is valid, or if it has been altered or when it isn't as I haven't been taught how to verify another bank's cashier check?
You are under no obligation to accept another bank's cashier's check for cash or deposit. Acceptance is going to be based on the relationship that you have with the presenter and possibly whether you can verify the check with the issuing bank, but most banks no longer do that.